import { createRouter, createWebHistory } from "vue-router";
import home_rout from "@/router/routes/home_rout";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [...home_rout],
});

// 动态设置标题
router.beforeEach((to, from, next) => {
  const title = to.meta.title;
  if (title) {
    document.title = title as string; // 设置文档标题
  }
  next();
});

export default router;
